home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / filesy~1 / mfs610s.zoo / docs / syscall.doc < prev   
Encoding:
Text File  |  1994-05-12  |  7.8 KB  |  213 lines

  1. This file describes some of the syscalls and some special aspects of the
  2. standard syscalls.
  3.  
  4. STAT (Fxattr)
  5.  
  6. Almost all the fields are relevant and not 'faked' unlike most of the
  7. standard filesystems. There are a couple of minor exceptions. For V1
  8. filesystems atime/adate and ctime/cdate fields are faked, they are
  9. the same as mtime/mdate; these are not faked for V2 filesystems. The
  10. nblocks field is faked by just assuming the file is continuous, this
  11. will usually be correct; if the file is sparse however this will be
  12. too high.
  13.  
  14. The 'dev' field is the drive with the standard form 0=A,1=B etc. The
  15. field 'index' is the inode number, this is again valid: if two files
  16. or file descriptors have the same inode and device numbers then they
  17. are the same file, otherwise they are different.
  18.  
  19. If there are character or block special files on the device then the
  20. field 'rdev' gets filled in appropriately.
  21.  
  22. DOPENDIR (DREADIR)
  23.  
  24. In normal mode you never get translated filenames, in addition the
  25. long field is the inode number.
  26.  
  27. RENAME
  28.  
  29. You can 'move' directories with this call, as would be expected for
  30. a U*ix like filesystem. This naturally moves all the contents of that
  31. subtree as well. This call will not allow a directory to be moved inside
  32. itself, as this would damage the filesystem (and is illegal anyway).
  33.  
  34. FDATIME
  35.  
  36. This is made fairly close to 'utimes', basically setting both atime/mtime
  37. to the value specified and ctime to the current time. It can't change the
  38. times for directories because MiNT blocks opening directories.
  39.  
  40. FATTR
  41.  
  42. This is largely faked, the fields aren't really valid for U*ix like
  43. filesystems. Only the DIR/RDONLY bits have any meaning, and RDONLY
  44. can be set as well.
  45.  
  46. VOLUME NAMES
  47.  
  48. Basically these don't exist. I suppose I could add support in some way if
  49. there was any demand.
  50.  
  51. LINK/SYMLINK
  52.  
  53. As would be expected these are perfectly valid. LINK does not allow hard links 
  54. to directories, even by superuser basically because there is no real need since
  55. symbolic links can do this and there would be no way to remove them.
  56.  
  57. UNLINK
  58.  
  59. Unlink behaves in a U*ix like manner with regard to open files. Basically you
  60. can unlink() an open file and let all processes with it open read/write as
  61. normal. When all processes close() the file (or exit which closes anyway) the
  62. space used by the file is freed up.
  63.  
  64. You can *not* unlink directories, this would be too risky and isn't needed
  65. anyway.
  66.  
  67. FSEEK
  68.  
  69. Minixfs allows the creation of sparse files in the usual way (seek past EOF and
  70. write).
  71.  
  72. DCNTL CALLS
  73.  
  74. The Dcntl syscall has several options for minixfs filesystems. The 'standard'
  75. calls FUTIME (set inode times) and FTRUNCATE (truncate file) exist as do their
  76. Fcntl (ioctl) equivalents. However also inluded are several Minixfs specific
  77. calls.
  78.  
  79. Opcode 0x100 MFS_VALID
  80.  
  81. This interprets the value of the additional argument as a long pointer, and
  82. is stores the value MFS_MAGIC there. This is intended so that the path passed 
  83. to Dcntl can verified as being on a minixfs filesystem. MFS_MAGIC has the
  84. value 0x1870431. Because of the possibility of other filesystems using the
  85. same numbers for Dcntl functions with different purposes (though none do as
  86. far as I know) MFS_VALID should always be called before using the other Minixfs
  87. specific opcodes and MFS_MAGIC checked.
  88.  
  89. Opcode 0x101 MFS_SYNC
  90.  
  91. Synchronise *all* filesystems, basically write out internal buffers to disk.
  92. Currently the filesystem internally sync()'s as well at various points, so 
  93. this call is not at present necessary before rebooting the system.
  94.  
  95. Opcode 0x102 MFS_CINVALID
  96.  
  97. Invalidate all cache entries for a given drive. This is used mainly internally.
  98.  
  99. Opcode 0x103 MFS_FINVALID
  100.  
  101. Invalidate all file descriptors on the given drive.
  102.  
  103. Opcode 0x104 MFS_INFO
  104.  
  105. This call basically returns some info about the Minixfs filesystem on which
  106. the path resides. It interprets the value of the additional parameter as a
  107. pointer to an mfs_info structure. This structure has the following form:
  108.  
  109. long total_inodes,total_zones;
  110. long free_inodes,free_zones;
  111. short version;
  112. short incr;
  113. long res1,res2,res3,res4;
  114.  
  115. (long=32 bits, short=16bits).
  116.  
  117. total_inodes and total_zones return the total number of inodes and zones
  118. for the filesystem. Similarly free_inodes and free_zones show how many are
  119. unused. A 'zone' is always 1K. version is 1 for V1 filesystems and 2 for
  120. V2. incr is the directory increment. You can use this to determine the 
  121. maximum filename size with the formula incr*16-2. The MiNT syscall Dconf
  122. can also be used for this purpose (see MiNT docs).
  123.  
  124. Opcode 0x106 MFS_IMODE
  125.  
  126. The extra paramater is interpreted as a long int. Its value is used to set
  127. the mode of *all* the bits of the file pathname points to. Including the
  128. type fields, thus you can change directories to files, and vice-versa.
  129. This is again root only. Extreme caution is needed with this syscall: it
  130. can do a lot of damage.
  131.  
  132. Opcode 0x107 MFS_GTRANS
  133. Opcode 0x108 MFS_STRANS
  134.  
  135. This call gets and sets the translation modes for this device. Only the
  136. superuser can do this. The extra parameter is interpreted as a long
  137. pointer. The scope corresponds to the following values.
  138.  
  139. #define NONE    0
  140. #define TOS     1
  141. #define MINT    2
  142. #define ALL     3
  143.  
  144. The 'type' is contained in groups of two bits. Bits 0-1 correspond to
  145. search translation, bits 2-3 are directory translation, bits 4-5 are for 
  146. creation translation and bits 6-7 are for execute translation. All other
  147. bits are currently ignored and should be set to zero.
  148.  
  149. Opcode 0x10a MFS_IADDR
  150.  
  151. The argument is a long pointer which will have the start address of Minixfs
  152. placed in it. If Minixfs has crashed then using this address along with the
  153. symbol table (or a suitable debugger) allows the precise point of the crash
  154. to be determined.
  155.  
  156. Opcode 0x10b MFS_UPDATE
  157.  
  158. This controls the update daemon. If no daemon is running (e.g. not Turbo mode)
  159. then this function returns -1. Otherwise the argument is a long which is
  160. interpreted as follows.
  161.  
  162. 0x0: Return 1 if daemon suspended, 0 if running.
  163. 0x1: Suspend execution of the daemon.
  164. 0x2: Resume execution of daemon.
  165. 0x3: Return the process id (pid) of the daemon (returns -1 if daemon not used)
  166.  
  167. Opcode 0x10c MFS_MOUNT
  168.  
  169. This is a bit experimental at present. It is used to mount one Minixfs
  170. filesystem on another and may go away some day if the kernel implements
  171. this (which is where it should really be). 'arg' is a pointer to the
  172. following structure:
  173.  
  174. unsigned int dev;
  175. long flags;
  176. long reserved[4];
  177.  
  178. dev is the device to mount (the path to Dcntl gives the path to mount on).
  179. flags is unused at present and should be set to zero. The reserved fields
  180. are also unused at present. The Dcntl path must be a directory other than
  181. the root directory. The filesystem of device 'dev' must not have any filesytems
  182. mounted on it already.
  183.  
  184. Opcode 0x10d MFS_UMOUNT
  185.  
  186. The filesystem the Dcntl path is on is umounted.
  187.  
  188. Opcode 0x10e MFS_LOPEN
  189.  
  190. arg points to the following structure:
  191.  
  192. long limit;
  193. unsigned int ilist[SIZE];
  194.  
  195. The field 'limit' should be set to the value of SIZE (the size of the ilist
  196. array). After this call the inode numbers of all open files on the Dcntl path
  197. filesystem are entered into the ilist array, followed by a zero terminator.
  198. If there isn't enough room in the array, it is truncated and ERANGE returned.
  199.  
  200. Opcode 0x10f MFS_MKNOD
  201.  
  202. arg is a long. The low word is a mode parameter which is the full mode of
  203. a character or block special file mode. The high word is the major/minor
  204. device numbers of the file. The Dcntl path is the path to create.
  205.  
  206. NOTE ON FILENAME TRANSLATION
  207.  
  208. Using minixfs filesystems you should always use the Dopendir etc. MiNT calls
  209. in normal mode. This way you never get translated filenames. You can use the
  210. Dconf or the MFS_INFO Dcntl syscalls to get the maximum filename length (if
  211. needed).
  212.  
  213.